﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ToolGood.Words;

namespace Dotnet.Utils.Utility.Other
{
    /// <summary>
    /// 拼音
    /// </summary>
    public static class WordHelper
    {
        public static void Main()
        {
            // 转成简体
            WordsHelper.ToSimplifiedChinese("我愛中國");
            WordsHelper.ToSimplifiedChinese("我愛中國", 1);// 港澳繁体 转 简体
            WordsHelper.ToSimplifiedChinese("我愛中國", 2);// 台湾正体 转 简体
                                                       // 转成繁体
            WordsHelper.ToTraditionalChinese("我爱中国");
            WordsHelper.ToTraditionalChinese("我爱中国", 1);// 简体 转 港澳繁体
            WordsHelper.ToTraditionalChinese("我爱中国", 2);// 简体 转 台湾正体
                                                        // 转成全角
            WordsHelper.ToSBC("abcABC123");
            // 转成半角
            WordsHelper.ToDBC("ａｂｃＡＢＣ１２３");
            // 数字转成中文大写
            WordsHelper.ToChineseRMB(12345678901.12);
            // 中文转成数字
            WordsHelper.ToNumber("壹佰贰拾叁亿肆仟伍佰陆拾柒万捌仟玖佰零壹元壹角贰分");
            // 获取全拼
            WordsHelper.GetPinyin("我爱中国");//WoAiZhongGuo   
            WordsHelper.GetPinyin("我爱中国", ",");//Wo,Ai,Zhong,Guo   
            WordsHelper.GetPinyin("我爱中国", true);//WǒÀiZhōngGuó

            // 获取首字母
            WordsHelper.GetFirstPinyin("我爱中国");//WAZG
                                               // 多音字获取全部拼音
            WordsHelper.GetAllPinyin('传');//Chuan,Zhuan
                                          // 获取姓名
            WordsHelper.GetPinyinForName("单一一");//ShanYiYi
            WordsHelper.GetPinyinForName("单一一", ",");//Shan,Yi,Yi
            WordsHelper.GetPinyinForName("单一一", true);//ShànYīYī

        }


        /// <summary>
        /// 转拼音字母
        /// </summary>
        /// <param name="str"></param>
        public static string ToPinYin(this string str)
        {
            return WordsHelper.GetPinyin(str).ToLower();
        }

        /// <summary>
        /// 转拼音首字母
        /// </summary>
        /// <param name="str"></param>
        public static string ToPinYinFirst(this string str)
        {
            return WordsHelper.GetFirstPinyin(str).ToLower();
        }

        /// <summary>
        /// 转中文简体
        /// </summary>
        public static string ToSimplifiedChinese(this string str) => WordsHelper.ToSimplifiedChinese(str);

        /// <summary>
        /// 转中文繁体字
        /// </summary>
        public static string ToTraditionalChinese(this string str) => WordsHelper.ToTraditionalChinese(str);
    }
}
